using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls.WebParts;

namespace TST.SharePoint.Shared
{
    /// <summary>
    /// Abastract class for an editor part to be used with the
    /// ContentByType webpart.
    /// </summary>
    public abstract class EditorBase : EditorPart
    {
        /// <summary>
        /// Get a strong typed reference to the webpart.
        /// </summary>
        public BaseDataWebPart WebPart
        {
            get
            {
                BaseDataWebPart webpart = WebPartToEdit as BaseDataWebPart;
                return webpart;
            }
        }

        //// Get the selected datasource for the webpart.
        //// Returns null if no datasource was selected.
        //public Datasource CurrentDataSource
        //{
        //    get
        //    {
        //        if ((WebPart != null) && (!string.IsNullOrEmpty(WebPart.DatasourceID)) && (WebPart.DatasourceID!=Guid.Empty.ToString("B")))
        //            return WebPart.DataSources[WebPart.DatasourceID];
        //        return null;
        //    }
        //}
    }
}
